//
//  ZWAudioStudioView.m
//  WanEr
//
//  Created by 高文萍 on 16/1/14.
//  Copyright © 2016年 ziwokeji. All rights reserved.
//

#import "ZWAudioStudioView.h"
#import "ZWHeader.h"
#import "PlayerManager.h"
#import "ZWPlayerViewController.h"
@interface ZWAudioStudioView()

@property (nonatomic, strong) UIView *audioStudioView;
@property (nonatomic, strong) UIImageView *studioImg;
@property (nonatomic, strong) UIImageView *iconImg;
@property (nonatomic, strong) UILabel *nameLabel;
@property (nonatomic, strong) UILabel *engNameLabel;
@property (nonatomic, strong) UIButton *playerBut;
@end
@implementation ZWAudioStudioView

+ (ZWAudioStudioView *)shareAudioStudioViewInitWithFrame:(CGRect)frame
{
    static ZWAudioStudioView *audioStudioView;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        audioStudioView = [[ZWAudioStudioView alloc]initWithFrame:frame];
        [audioStudioView createAudioStudioView];
    });
    return audioStudioView;
}

- (void)createAudioStudioView
{
    self.audioStudioView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTHVIEW, HEIGHTVIEW)];
    [self addSubview:self.audioStudioView];
    self.studioImg = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.audioStudioView.bounds.size.width, self.audioStudioView.bounds.size.height)];
    self.studioImg.image = [UIImage imageNamed:@"底图"];
    [self.audioStudioView addSubview:self.studioImg];
    
    self.studioImg = [[UIImageView alloc]init];
    self.studioImg.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"占位图"]];
    self.studioImg.image = [UIImage imageNamed:@"头像"];
    [self.audioStudioView addSubview:self.studioImg];
    [self.studioImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.width.equalTo(@(33));
        make.height.equalTo(@33);
        make.left.equalTo(@(15));
    }];
    
    self.nameLabel = [[UILabel alloc]init];
    self.nameLabel.font = [UIFont systemFontOfSize:12];
//    self.nameLabel.text = @"鼓浪屿";
     
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    [self.audioStudioView addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.audioStudioView);
        make.top.equalTo(@(10));
        make.height.equalTo(@(15));
        
    }];
    
    self.engNameLabel = [[UILabel alloc]init];
    self.engNameLabel.text = @"asdfsfsdf";
    self.engNameLabel.textAlignment = NSTextAlignmentCenter;
    self.engNameLabel.font = [UIFont systemFontOfSize:10];
    [self.audioStudioView addSubview:self.engNameLabel];
    [self.engNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.audioStudioView);
        make.top.equalTo(self.nameLabel.mas_bottom).offset(2);
        make.height.equalTo(@(15));
    }];
    
    self.playerBut = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.playerBut setImage:[UIImage imageNamed:@"Triangle 2"] forState:UIControlStateNormal];
    [self.playerBut addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    [self.audioStudioView addSubview:self.playerBut];
    [self.playerBut mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self);
        make.right.equalTo(@(-20));
        make.width.equalTo(@(12));
        make.height.equalTo(@(17));
    }];
    
}

- (void)click:(UIButton *)button
{
    
}

@end
